<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>


<?php $action = url_for('echantillon/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id_echantillon='.$form->getObject()->getIdEchantillon() : '?id_lot='.$lot->getIdLot())); ?>
<?php //if(isset($lot)) $action = url_for('lot/createEchantillon?id_lot='.$lot->getIdLot()) ?>

<form action="<?php echo $action ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<?php endif; ?>
  <table class="formulaire">
      <thead>
          <tr><th colspan="4">Fiche échantillon</th></tr>
      </thead>
    <tfoot>
      <tr>
        <td colspan="4">
          <?php echo $form->renderHiddenFields(false) ?>
          <input type="submit" value="Enregistrer" class="submit" />
          <?php if($form->getObject()->isNew()) : ?>
            <a href="<?php echo url_for('lot/show?id_lot='.$lot->getIdLot()) ?>" class="submit">Annuler</a>
          <?php else : ?>
            <a href="<?php echo url_for('echantillon/show?id_echantillon='.$echantillon->getIdEchantillon()) ?>" class="submit">Annuler</a>
          <?php endif; ?>
        </td>
      </tr>
    </tfoot>
    <tbody>
      <?php echo $form->renderGlobalErrors() ?>
      <tr>
        <th colspan="2"><?php echo $form['nom']->renderLabel() ?></th>
        <td><?php echo $form['nom'] ?></td>
        <td><?php echo $form['nom']->renderError() ?></td>
      </tr>
      <tr>
        <th colspan="2"><?php echo $form['id_lot']->renderLabel() ?></th>
        <td><?php if(!isset($lot)) echo $form['id_lot']; else echo $lot->getNom() ?></td>
        <td><?php echo $form['id_lot']->renderError() ?></td>
      </tr>
      <tr>
        <th colspan="2"><?php echo $form['date_creation']->renderLabel() ?></th>
        <td>
            <input id="label_choix_date" disabled="disabled" value="<?php if ($form->getObject()->getDateCreation()) echo $form->getObject()->getDateTimeObject('date_creation')->format('D, d M, Y'); ?>"></input>
            <?php echo $form['date_creation'] ?></td>
        <td><?php echo $form['date_creation']->renderError() ?></td>
      </tr>
        <th colspan="2"><?php echo $form['id_etat_echantillon']->renderLabel() ?></th>
        <td><?php echo $form['id_etat_echantillon'] ?></td>
        <td><?php echo $form['id_etat_echantillon']->renderError() ?></td>
      </tr>
      <tr>
        <th colspan="2"><?php echo $form['id_lieu']->renderLabel() ?></th>
        <td><?php echo $form['id_lieu'] ?></td>
        <td><?php echo $form['id_lieu']->renderError() ?></td>
      </tr>
      <tr>
        <th colspan="2"><?php echo $form['id_type_forme']->renderLabel() ?></th>
        <td><?php echo $form['id_type_forme'] ?></td>
        <td><?php echo $form['id_type_forme']->renderError() ?></td>
      </tr>
      <tr id="tr_epaisseur">
          <th></th>
          <th><?php echo $form['epaisseur']->renderLabel() ?></th>
          <td><?php echo $form['epaisseur'] ?></td>
          <td><?php echo $form['epaisseur']->renderError() ?></td>
      </tr>
      <tr id="tr_diametre">
          <th></th>
          <th><?php echo $form['diametre']->renderLabel() ?></th>
          <td><?php echo $form['diametre'] ?></td>
          <td><?php echo $form['diametre']->renderError() ?></td>
      </tr>
      <tr id="tr_longueur">
          <th></th>
          <th><?php echo $form['longueur']->renderLabel() ?></th>
          <td><?php echo $form['longueur'] ?></td>
          <td><?php echo $form['longueur']->renderError() ?></td>
      </tr>
      <tr id="tr_largeur">
          <th></th>
          <th><?php echo $form['largeur']->renderLabel() ?></th>
          <td><?php echo $form['largeur'] ?></td>
          <td><?php echo $form['largeur']->renderError() ?></td>
      </tr>
      <tr id="tr_rectangle">
          <th></th>
          <th><?php echo $form['rectangle']->renderLabel() ?></th>
          <td><?php echo $form['rectangle'] ?></td>
          <td><?php echo $form['rectangle']->renderError() ?></td>
      </tr>
      <tr id="tr_a">
          <th></th>
          <th><?php echo $form['a']->renderLabel() ?></th>
          <td><?php echo $form['a'] ?></td>
          <td><?php echo $form['a']->renderError() ?></td>
      </tr>
      <tr id="tr_b">
          <th></th>
          <th><?php echo $form['b']->renderLabel() ?></th>
          <td><?php echo $form['b'] ?></td>
          <td><?php echo $form['b']->renderError() ?></td>
      </tr>
      <tr id="tr_c">
          <th></th>
          <th><?php echo $form['c']->renderLabel() ?></th>
          <td><?php echo $form['c'] ?></td>
          <td><?php echo $form['c']->renderError() ?></td>
      </tr>
    </tbody>
  </table>
</form>
